package com.naiterui.ehp.bs.pharmacist.entity;

// default package

import com.naiterui.ehp.bp.constants.CommonConstant;

import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * 处方实体：包含部分字段，只供本服务 查询使用，详细已推荐服务为准
 */
@Entity
@Table(name = "dr_medication_recom")
@DynamicUpdate
public class PharmacistMedicationRecom implements java.io.Serializable {


    /**
     * 强制推荐标识 0:推荐未发送
     */
    public static final int FORCE_RECOM_STATUS_NOT_SEND = 0;
    /**
     * 强制推荐标识 1:非强制推荐发送
     */
    public static final int FORCE_RECOM_STATUS_SEND = 1;
    /**
     * 强制推荐标识 2:强制推荐(不进行电子签名)发送
     */
    public static final int FORCE_RECOM_STATUS_FORCE_SEND = 2;

    /**
     *
     */
    private static final long serialVersionUID = -207725987946355840L;
    private Long id;
    private Long doctorId;
    private Long patientId;
    private String orderId;
    /**
     * 问诊会话id：<code>sessionId</code>
     */
    private Long sessionId;
    private Integer orderAmount;
    /**
     * 推荐类型：<code>type</code>
     * 1普通推荐,2求药推荐,3系统推荐
     */
    private Integer type;
    private Long requireId;
    /**
     * 推荐用药是否购药，0：未购，1：已全部购买，2：已下单（未回调），3：部分购买, 4:已取消
     */
    private Integer status;
    private String extId;
    private Date createdAt;
    private Date changedAt;
    private Date expireAt;
    /**
     * 处方笺流水号：<code>serialNumber</code>
     */
    private String serialNumber;
    /**
     * 处方笺临床诊断：<code>diagnosis</code>
     */
    private String diagnosis;
    /**
     * 强制推荐标识 0:推荐未发送, 1:非强制推荐,2:强制推荐(不进行电子签名)：<code>forceRecom</code>
     */
    private Integer forceRecom;


    /**
     * 创建MedicationRecom实例
     */
    public PharmacistMedicationRecom() {
        super();
    }

    /**
     * 创建MedicationRecom实例
     *
     * @param doctorId
     * @param patientId
     */
    public PharmacistMedicationRecom(Long doctorId, Long patientId, String extId, Long expiration, Integer type, Long requireId, Integer forceRecom,
                                     String diagnosis) {
        super();
        this.doctorId = doctorId;
        this.patientId = patientId;
        status = CommonConstant.DOCTOR_RECOM_STATUS_NOT_BUY;
        this.extId = extId;
        this.type = type;
        this.requireId = requireId;
        Date date = new Date();
        createdAt = date;
        changedAt = date;
        expireAt = new Date(date.getTime() + expiration);
        this.diagnosis = diagnosis;
        this.forceRecom = forceRecom;
    }

    // Property accessors
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "doctor_id")
    public Long getDoctorId() {
        return doctorId;
    }

    public void setDoctorId(Long doctorId) {
        this.doctorId = doctorId;
    }

    @Column(name = "patient_id")
    public Long getPatientId() {
        return patientId;
    }

    public void setPatientId(Long patientId) {
        this.patientId = patientId;
    }

    @Column(name = "order_id")
    public String getOrderId() {
        return orderId;
    }

    /**
     * @return Long 取得域 sessionId 的方法。
     */
    @Column(name = "session_id")
    public Long getSessionId() {
        return sessionId;
    }

    /**
     * @param sessionId 对域 sessionId 的设置方法.
     */
    public void setSessionId(Long sessionId) {
        this.sessionId = sessionId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    @Column(name = "order_amount")
    public Integer getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(Integer orderAmount) {
        this.orderAmount = orderAmount;
    }

    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Column(name = "ext_id")
    public String getExtId() {
        return extId;
    }

    public void setExtId(String extId) {
        this.extId = extId;
    }

    @Column(name = "created_at", length = 19)
    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    @Column(name = "changed_at", length = 19)
    public Date getChangedAt() {
        return changedAt;
    }

    public void setChangedAt(Date changedAt) {
        this.changedAt = changedAt;
    }

    /**
     * @return Date 取得域 expireAt 的方法。
     */
    @Column(name = "expire_at", length = 19)
    public Date getExpireAt() {
        return expireAt;
    }

    /**
     * @param expireAt 对域 expireAt 的设置方法.
     */
    public void setExpireAt(Date expireAt) {
        this.expireAt = expireAt;
    }

    /**
     * @return Integer 取得域 type 的方法。
     */
    @Column(name = "type")
    public Integer getType() {
        return type;
    }

    /**
     * @param type 对域 type 的设置方法.
     */
    public void setType(Integer type) {
        this.type = type;
    }

    /**
     * @return Long 取得域 requireId 的方法。
     */
    @Column(name = "require_id")
    public Long getRequireId() {
        return requireId;
    }

    /**
     * @param requireId 对域 requireId 的设置方法.
     */
    public void setRequireId(Long requireId) {
        this.requireId = requireId;
    }

    /**
     * @return String 取得域 diagnosis 的方法。
     */
    @Column(name = "diagnosis")
    public String getDiagnosis() {
        return diagnosis;
    }

    /**
     * @param diagnosis 对域 diagnosis 的设置方法.
     */
    public void setDiagnosis(String diagnosis) {
        this.diagnosis = diagnosis;
    }

    /**
     * @return String 取得域 serialNumber 的方法。
     */
    @Column(name = "serial_number")
    public String getSerialNumber() {
        return serialNumber;
    }

    /**
     * @param serialNumber 对域 serialNumber 的设置方法.
     */
    public void setSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
    }

    @Column(name = "force_recom")
    public Integer getForceRecom() {
        return forceRecom;
    }

    public void setForceRecom(Integer forceRecom) {
        this.forceRecom = forceRecom;
    }


}